#ifndef __SPI_HARD_DRV_H__
#define __SPI_HARD_DRV_H__
#include "gd32f30x.h"

/*************** pin config *****************/
// scl
#define SPI_HARD_CLK_RCU	RCU_GPIOB
#define SPI_HARD_CLK_PORT	GPIOB
#define SPI_HARD_CLK_PIN	GPIO_PIN_13

// MOSI 
#define SPI_HARD_MOSI_RCU	RCU_GPIOB
#define SPI_HARD_MOSI_PORT	GPIOB
#define SPI_HARD_MOSI_PIN	GPIO_PIN_15

// MISO 
#define SPI_HARD_MISO_RCU	RCU_GPIOB
#define SPI_HARD_MISO_PORT	GPIOB
#define SPI_HARD_MISO_PIN	GPIO_PIN_14

/*************** spi config *****************/

#define USE_SPI_X  SPI1
#define SPI_RCU_X  RCU_SPI1
// 超时次数
#define OUT_TIMES 100000


/**
 * @desc  : SPI硬件初始化
 * @date  : 2025-04-25
 * @author: AnRui
 * @note  :
 */
void SpiHardDrvInit(void);

/**
 * @desc  : SPI发送和接收数据
 * @date  : 2025-04-25
 * @author: AnRui
 * @param : data - {参数说明}:
 * @return: uint8_t
 * @note  :
 */
uint8_t SpiHardDrvReadWriteByte(uint8_t data);


#endif // __SPI_HARD_DRV_H__
